﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Data;
using System.Globalization;

namespace BadHabit.Factory.Converters {

    [ValueConversion(typeof(Int32), typeof(string))]
    public class TaskIdConverter : IValueConverter {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {

            if (!(value is Int32))
                return "";

            int taskId = (int)value;

            if (taskId < 0)
                return "";

            return String.Format("{0:00000}", taskId);

        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            return new NotSupportedException();
        }



    }
}
